package logic

import (
	"context"
	"wechat/models/mysql"

	"wechat/wechatrpc/internal/svc"
	"wechat/wechatrpc/wechatrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type CircleAddLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewCircleAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CircleAddLogic {
	return &CircleAddLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *CircleAddLogic) CircleAdd(in *wechatrpc.CircleAddRequest) (*wechatrpc.CircleAddResponse, error) {
	// todo: add your logic here and delete this line
	cc := mysql.Circle{
		Context: in.Context,
		UserId:  int(in.UserId),
	}
	mysql.DB.Create(&cc)
	return &wechatrpc.CircleAddResponse{
		Id: int64(cc.ID),
	}, nil
}
